/*	This file is part of AstroAttack.
*
*	AstroAttack is free software; you can redistribute it and/or modify
*	it under the terms of the GNU General Public License as published by
*	the Free Software Foundation; either version 2 of the License, or
*	(at your option) any later version.
*	
*	AstroAttack is distributed in the hope that it will be useful,
*	but WITHOUT ANY WARRANTY; without even the implied warranty of
*	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*	GNU General Public License for more details.
*	
*	You should have received a copy of the GNU General Public License
*	along with AstroAttack; if not, write to the Free Software
*	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*	
*	$Id: Debug.java 11 2006-12-27 03:57:41Z xdracox $
*/

/**	The AstroAttack package contains all the classes that belong to the
*	AstroAttack program.
*/
package AstroAttack;

/**	The Debug class contains console printing methods that only print out
*	when debugging has been turned on.
*/
public class Debug
{
	/**	Private constructor so that an instance of Debug cannot be created. */
	private Debug()
	{
	}
	
	/**	Wether or not debugging is on. */
	private static boolean m_debug = false;
	
	/**	Turns debugging on. */
	public static void turnOn()
	{
		m_debug = true;
	}
	
	/** Turns debugging off. */
	public static void turnOff()
	{
		m_debug = false;
	}
	
	/** Toggles debugging. */
	public static void toggle()
	{
		m_debug = !m_debug;
	}
	
	/**	Prints out the object's toString() method and a new line.
	*	@param	p_obj	Object to print
	*/
	public static void println(Object p_obj)
	{
		if ( m_debug )
			System.out.println(p_obj);
	}
	
	/** Prints out the object's toString() method.
	*	@param	p_obj	Object to print
	*/
	public static void print(Object p_obj)
	{
		if ( m_debug )
			System.out.print(p_obj);
	}
}
